﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RayTracer.Kernels
{
    /// <summary>
    /// Beinhaltet den OpenCL Code der Kernel.
    /// </summary>
    partial class KernelConvertColor
    {
        private const string KERNEL_MAIN = "ConColor";

        /*************
        *  
        *  Eingabe:
        *  fcolor      Die Fließkomma-Farbe.                    [i]
        *  
        * 
        *  Ausgabe:
        *  bcolor      Die Byte-Farbe.                          [i]
        *  
        *************/
        private const string KERNEL_SOURCE = @"
            kernel void ConColor(
                global  read_only float4* fcolor, 

                global  write_only uchar4* bcolor
            )
            {
                int i = get_global_id(0);
                bcolor[i] = (uchar4)((uchar)min(255.0f,fcolor[i].s0*255.0f),
                                     (uchar)min(255.0f,fcolor[i].s1*255.0f),
                                     (uchar)min(255.0f,fcolor[i].s2*255.0f),
                                     (uchar)255);
            }
            ";
    }
}
